<template>
	<view v-if="pageShow" class="container">
		<view class="title">
			{{dataObj.title}}
		</view>
		<view class="date">
			{{createTime}}
		</view>
		<view class="content">
			<mp-html :content="dataObj.content"></mp-html>
		</view>
		<view class="read">
			阅读：{{dataObj.brows}}
		</view>
	</view>
</template>

<script>
	import newsApi from "@/api/myNews.js"
	export default {
		data() {
			return {
				newsId: '',
				dataObj: {},
				createTime: '',
				pageShow: false
			}
		},
		onLoad(e) {
			this.newsId = e.id
			this.getDetail()
		},
		methods: {
			async getDetail() {
				let res = await newsApi.getListInfo({id: this.newsId})
				if(res.code === 1) {
					this.dataObj = res.data
					this.createTime = this.$moment(res.data.createtime*1000).format('YYYY年MM月DD日')
					this.pageShow = true
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
@import 'detailNews.scss';
</style>
